5 const int MAXN
= 1000010;
9 int maximum_repetitions(int n
, int k
) {
13 for (int i
= 0; i
< n
; ++i
) {
14 border
[i
+1] = border
[i
];
15 while (border
[i
+1] > -1 and s
[border
[i
+1]] != s
[i
]) border
[i
+1] = border
[border
[i
+1]];
19 return 1 + (k
- n
) / (n
- border
[n
]);
24 while (scanf("%d %s", &k
, s
) == 2) {
27 printf("%d\n", maximum_repetitions(n
, k
));